//
//  LoginMainView.m
//  DirectProDuct
//
//  Created by hl on 16/1/20.
//  Copyright (c) 2016年 ping. All rights reserved.
//

#import "LoginMainView.h"

@implementation LoginMainView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createdSubView];
    }
    return self;
}
-(void)createdSubView{
    UILabel *nameLab = [[UILabel alloc] initWithFrame:CGRectMake(40 * _kscW, 100 * _kscH, 50 * _kscW, 30 * _kscH)];
    nameLab.text = @"用户名:";
    nameLab.font = [UIFont systemFontOfSize:13.0];
    [self addSubview:nameLab];
    
    self.nameField = [[UITextField alloc] initWithFrame:CGRectMake(nameLab.right, nameLab.top, KScreenWidth - nameLab.right - 40 * _kscW, nameLab.height)];
    [self.nameField setBorderStyle:UITextBorderStyleRoundedRect];
    self.nameField.font = [UIFont systemFontOfSize:13.0];
    self.nameField.returnKeyType = UIReturnKeyDone;
    self.nameField.delegate = self;
    [self addSubview:self.nameField];
    
    UILabel *passWordLab = [[UILabel alloc] initWithFrame:CGRectMake(nameLab.left, self.nameField.bottom + 10* _kscH, nameLab.width, nameLab.height)];
    passWordLab.font = [UIFont systemFontOfSize:13.0];
    passWordLab.text = @"密 码:";
    [self addSubview:passWordLab];
    
    self.passWordField = [[UITextField alloc] initWithFrame:CGRectMake(passWordLab.right, passWordLab.top, self.nameField.width, passWordLab.height)];
    [self.passWordField setBorderStyle:UITextBorderStyleRoundedRect];
    self.passWordField.font = [UIFont systemFontOfSize:13.0];
    self.passWordField.returnKeyType = UIReturnKeyDone;
    self.passWordField.delegate = self;
    [self addSubview:self.passWordField];
    
    self.loginBtn = [[UIButton alloc] initWithFrame:CGRectMake(30 * _kscW, self.passWordField.bottom + 60 * _kscH, KScreenWidth - 60 * _kscW, 35 * _kscH)];
    self.loginBtn.layer.cornerRadius = 3;
    [self.loginBtn setTitle:@"登录" forState:UIControlStateNormal];
    self.loginBtn.titleLabel.font = [UIFont fontWithName:TextJiaCu size:17.0];
    [self.loginBtn setBackgroundColor:[UIColor redColor]];
    [self addSubview:self.loginBtn];
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
